<table>
  <tr>
  <th>标题</th>
  <th>作者</th>
  <th>撰写日期</th>
  </tr>

<% for document in @documents %>
  <% if(document.parent_id==0) then%> 
  <tr>
  <td><%=link_to document.title,document_url(document.id)%></td>
  <td><%=document.member.nickname%></td>
  <td><%=document.create_date%></td>
    <td><%= link_to 'Show', document %></td>
    <td><%= link_to 'Edit', edit_document_path(document) %></td>
    <td><%= link_to 'Destroy', document, :confirm => 'Are you sure?', :method => :delete %></td>
  </tr>
  <tr>
  <td><%=show_children(document.children)%></td>
  </tr>
  <% end %>
<% end %>
</table>

<br />

<%= link_to 'New document', new_document_path %>
